package com.example.myspringpro.entity;

import com.example.myspringpro.enums.UserSexEnum;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.Date;

/**
 * @Description
 * @Author allenhu <huxiangneng@163.com>
 * @Date 2019/04/30
 * @Version V1.0.0
 **/
@Data
@NoArgsConstructor
public class User{

    private int id;

    /**
     * 用户名
     */
    @NotEmpty(message = "用户名不能为空")
    @Size(min = 2, max = 20, message = "用户名长度必须在2到20位之间")
    private String userName;
    /**
     * 年龄
     */
    private int age;

    /**
     * 性别
     */
    private int sex = UserSexEnum.MALE.getCode();
    /**
     * 密码
     */
    private String password;
    /**
     * 状态
     */
    private byte status;
    /**
     * 添加时间
     */
    private Date addTime;
    /**
     * 修改时间
     */
    private Date updateTime;
    /**
     * 登录时间
     */
    private Date loginTime;
    /**
     * 邮箱
     */
    @Email
    private String email;
}
